package com.lizhen.j2eepattern.dataaceessobjectpattern;

import com.lizhen.j2eepattern.dataaceessobjectpattern.impl.StudentDaoImpl;

import java.util.Iterator;

public class DataAceessObjectPattern {
    public DataAceessObjectPattern() {
    }

    public static void main(String[] args) {
        StudentDao studentDao = new StudentDaoImpl();
        Iterator var3 = studentDao.getAllStudents().iterator();

        Student student;
        while (var3.hasNext()) {
            student = (Student) var3.next();
            System.out.println("Student: [RollNo : " + student.getRollNo() + ", Name : " + student.getName() + " ]");
        }

        student = (Student) studentDao.getAllStudents().get(0);
        student.setName("Michael");
        studentDao.updateStudent(student);
        student = studentDao.getStudent(0);
        System.out.println("Student: [RollNo : " + student.getRollNo() + ", Name : " + student.getName() + " ]");
    }
}
